package com.wetask.domain.model;

public class PagingInfo {
	private Integer pageSize;
	private Integer pageIndex;
	private Integer totalItems;
	private Integer offset;
	private Integer currentItemIndex;
	
	public Integer getPageSize() {
		int totalPage = totalItems / offset;
		pageSize =  (totalItems % offset) > 0? (totalPage += 1) : totalPage;
		return pageSize;
	}
	public PagingInfo(Integer offset, Integer pageIndex) {
		super();
		this.offset = offset;
		this.pageIndex = pageIndex;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public Integer getPageIndex() {
		return pageIndex;
	}
	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
	}
	public Integer getTotalItems() {
		return totalItems;
	}
	public void setTotalItems(Integer totalItems) {
		this.totalItems = totalItems;
	}
	public Integer getOffset() {
		return offset;
	}
	public void setOffset(Integer offset) {
		this.offset = offset;
	}
	public Integer getCurrentItemIndex() {
		currentItemIndex = (pageIndex - 1) * offset + 1;
		return currentItemIndex;
	}
	public void setCurrentItemIndex(Integer currentItemIndex) {
		this.currentItemIndex = currentItemIndex;
	}

}
